home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 13
/
AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso
/
rexx
/
flushgadgets.sirexx
< prev
next >
Wrap
Text File
|
1997-09-10
|
2KB
|
73 lines
/* This will attempt to expunge all unused Gadgets/classes from memory */
/* IMPORTANT! Due to a bug in earlier glyph.image versions that will
crash if it's asked to expunge itself. Do NOT use this
script if you have glyph.image 41.4 or older!
*/
options results
signal on error
address 'INSPECTOR.1'
/* Select the Libs list. */
GetDisplay ; currentdisplay = result
If currentdisplay ~= 5 Then SetDisplay 5
/* We don't want to be bothered with requesters */
GetPrefs Confirm ; oldconfirm = result
if oldconfirm = "ON" Then SetPrefs Confirm OFF
/* browse thru the list until we reach the last item. */
flushed = 0
counter = 0
done = 0
Do while done = 0
SelectNode Num counter ; if result = "ERROR" then done = 1
If done = 0 Then Do
GetNodeInfo 1 ; nodename = result
If Pos(".gadget",nodename) >0 | Pos(".class",nodename) >0 | Pos(".image",nodename) >0 Then Do
SetStatus "Flushing..."
FlushNode
/* If the node is gone, then the next node was moved one level to the
top - so our next node is on that same position. So, we won't
move down, so next iteration will be on this bubbled-up node. */
GetStatus ; status = result
If Pos("Flushed",status) > 0 Then Do
counter = counter - 1 /* So we do not skip the new one */
flushed = flushed + 1
End
End
counter = counter + 1
End
End
/* Restore the Confirm setting */
SetPrefs Confirm oldconfirm
/* Report */
SetStatus 'Flushed '||flushed||' gadgets(s).'